@import '../../../themes/basic/base-all.less';

:host {
  --ti-swiper-icon-height: var(--ti-common-size-12x);
  --ti-swiper-icon-color: var(--ti-common-color-icon-white);
  --ti-swiper-icon-color-hover: var(--ti-common-color-icon-white);
  --ti-swiper-icon-bg-color: rgba(0, 0, 0, 0.2);
  --ti-swiper-icon-bg-color-hover: rgba(0, 0, 0, 0.3);
  --ti-swiper-finite-icon-color: rgba(255, 255, 255, 0.4);
  --ti-swiper-pagination-space: var(--ti-common-space-7x); // 指示器距离容器元素间距
  --ti-swiper-pagination-bullets-space: var(--ti-common-space-6);
  --ti-swiper-multiple-icon-bg-color: var(--ti-common-color-transparent);
  --ti-swiper-multiple-icon-bg-color-hover: var(--ti-common-color-transparent);
  --ti-swiper-bullet-border: 2.5px;
}

:host {
  display: block;
  position: relative; // 相对于自己定位，在正常文档流中占位
}

.ti3-swiper-container {
  .flex-container(row, center, center);
  position: relative;
}

// 左右侧按钮公共样式
.ti3-swiper-arrow {
  flex-shrink: 0;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  top: calc((100% - var(--ti-swiper-icon-height)) / 2); // IE下需要设置top定位，否则会居下显示
  z-index: 1;
  font-size: var(--ti-common-size-4x);
  width: var(--ti-common-size-6x);
  height: var(--ti-swiper-icon-height);
  background: var(--ti-swiper-icon-bg-color);
  text-align: center;
  cursor: pointer;
  color: var(--ti-swiper-icon-color);
  border-radius: var(--ti-common-border-radius-normal);

  &:not(.ti3-swiper-finite-arrow):hover,
  &:not(.ti3-swiper-finite-arrow):focus {
    color: var(--ti-swiper-icon-color-hover);
    background: var(--ti-swiper-icon-bg-color-hover);
  }
}

.ti3-swiper-finite-arrow {
  cursor: not-allowed;

  ti-icon[local] {
    color: var(--ti-swiper-finite-icon-color);
  }
}

// 左侧按钮
.ti3-swiper-prev {
  left: var(--ti-common-space-0);
}

// 右侧按钮
.ti3-swiper-next {
  right: var(--ti-common-space-0);
}

// 多图轮播左右按钮样式
:host.ti3-swiper-multiple {
  .ti3-swiper-wrapper {
    margin: 0 var(--ti-common-space-10);
  }

  .ti3-swiper-arrow {
    position: static;
    background: var(--ti-swiper-multiple-icon-bg-color);
    color: var(--ti-common-color-icon-normal);

    &:not(.ti3-swiper-finite-arrow):hover,
    &:not(.ti3-swiper-finite-arrow):focus {
      background: var(--ti-swiper-multiple-icon-bg-color-hover);
      color: var(--ti-common-color-icon-hover);
    }
  }
}

// 卡片容器
.ti3-swiper-wrapper {
  position: relative; // 让卡片相对于该元素定位
  overflow-x: hidden;
  width: 100%;

  .ti3-swiper-cards-container {
    position: relative;
    display: flex;
  }
}

// 面板指示点样式
.ti3-swiper-pagination-bullets {
  text-align: center;
  margin-top: var(--ti-swiper-pagination-space);

  .ti3-swiper-pagination-bullet {
    display: inline-block;
    .box-sizing(border-box);
    border: var(--ti-swiper-bullet-border) solid var(--ti-common-color-line-normal);
    background-color: var(--ti-common-color-line-normal);
    border-radius: var(--ti-swiper-bullet-border);
    margin: 0 0 0 var(--ti-swiper-pagination-bullets-space);
    cursor: pointer;

    &:first-child {
      margin: 0;
    }

    // 激活后当前bullet样式
    &.ti3-swiper-pagination-bullet-active {
      width: var(--ti-common-size-5x);
      border-color: var(--ti-common-color-line-hover);
      background-color: var(--ti-common-color-line-hover);
    }
  }
}

// 指示器在底部样式
.ti3-swiper-pagination-bullets-bottom {
  position: absolute;
  width: 100%;
  bottom: var(--ti-swiper-pagination-space);
  margin-top: 0;
}

// 指示器在右侧样式，预留样式
.ti3-swiper-pagination-bullets-right {
  position: absolute;
  width: 5px;
  right: var(--ti-swiper-pagination-space);
  top: 50%;
  transform: translateY(-50%);
  margin-top: 0;

  .ti3-swiper-pagination-bullet {
    margin: 0 0 var(--ti-swiper-pagination-bullets-space) 0;

    &.ti3-swiper-pagination-bullet-active {
      width: 5px;
      height: 20px;
      border-color: var(--ti-common-color-line-hover);
      background-color: var(--ti-common-color-line-hover);
    }
  }
}
